<!doctype html>
<html>
<head>
    <meta charset="UTF-8">
    <title>演示demo</title>
    <link href="__ROOT__/Public/favicon.ico" type="image/x-icon" rel="shortcut icon">
    <link rel="stylesheet" type="text/css" href="__PUBLIC__/admin/css/base.css" media="all">
    <link rel="stylesheet" href="__STATIC__/iconpicker/css/icon-picker.css">
    <link rel="stylesheet" type="text/css" href="__PUBLIC__/admin/css/common.css" media="all">
    <link rel="stylesheet" type="text/css" href="__PUBLIC__/admin/css/module.css">
    <link rel="stylesheet" type="text/css" href="__PUBLIC__/admin/css/style.css" media="all">
    <script type="text/javascript" src="__PUBLIC__/admin/js/jquery.js"></script>

    <meta name="renderer" content="webkit">
    <meta http-equiv="X-UA-Compatible" content="IE=edge,chrome=1" />
    <style type="text/css">
        body {
                padding: 10px 0 0 10px
            }
    </style>
</head>
<body style="align-content: center ; width: 60% ;margin-left: 20%;">
    <div class="main-title">
        <h2>{$meta_title}</h2>
    </div>
    <form action="{:U()}" method="post" style="align-content: center ; " class="form-horizontal" enctype="multipart/form-data">
        <div class="form-item">
        </div>
        <div class="form-item">
            <label class="item-label">学校名称<span class="check-tips">*</span></label>
            <div class="controls">
                <input type="text" class="text" name="name" value="{$info.name}">
            </div>
        </div>
        <div class="form-item">
            <label class="item-label">标签</label>
            <div class="controls">
                <volist name="tag_list" id="vo">
                    <input type="checkbox" value="{$key}" name="tag[]" <if condition="in_array($key,$info['tag'])">checked</if>>{$vo} &nbsp;&nbsp;
                </volist>
            </div>
        </div>
        <div class="form-item">
            <label class="item-label">学校地址</label>
            <div class="controls">
                <input type="text" value="{$info.address}" name="address">
            </div>
        </div> <div class="form-item">
        <label class="item-label"> 学校电话</label>
        <div class="controls">
            <input type="tel" value="{$info.phone}" name="phone">
        </div>
    </div>
        <div class="form-item">
            <label class="item-label">创建时间</label>
            <div class="controls">
                <input type="date" value="{$info.create_time|date='Y-m-d',###}" name="create_time">
            </div>
        </div>
        <if condition="$info['photo']">
            <div class="form-item">
                <label class="item-label">上传的照片 <a href="#" id="del" style="margin-left: 30px">删 除</a></label>
                <div class="controls">
                    <img src="{$info.photo}" width="200px">
                </div>
            </div>
        </if>
        <div class="form-item">
            <label class="item-label">上传照片</label>
            <div class="controls">
                <input type="file" value="" name="photo">
            </div>
        </div>
        <div class="form-item">
            <label class="item-label">学校概况</label>
            <div class="controls">
                <textarea cols="50" rows="5"  name="content" >{$info.content} </textarea>
            </div>
        </div>
        <div class="form-item">
            <input type="hidden" name="id" value="{$info.id}"/>
            <button class="btn submit-btn" id="submit" type="submit">确 定</button>
            <button class="btn btn-return" onclick="javascript:history.back(-1);return false;">返 回</button>
        </div>
    </form>
</body>

<script type="text/javascript" charset="utf-8">
    $('#del').click(function(){
        if(confirm('是否确定删除照片')){
            var id = $('input[name="id"]').val();
            // Ajax提交数据
            $.ajax({
                url: "{:U('ajaxDelImg')}", // 提交到controller的url路径
                type: "post",    // 提交方式
                data: {id:id},  // data为String类型，必须为 Key/Value 格式。
                dataType: "json",    // 服务器端返回的数据类型
                success: function (rst) {    // 请求成功后的回调函数，其中的参数data为controller返回的map,也就是说,@ResponseBody将返回的map转化为JSON格式的数据，然后通过data这个参数取JSON数据中的值
                    alert(rst.msg);
                    if (rst.status) {
                        /*删除成功  0.5秒后刷新页面*/
                        setTimeout(function () {
                            location.reload();
                        }, 500);
                    }
                },
            });
        }
    })
</script>
</html>
